<script>

var tabNames = {};
var tabRestore = {};

chrome.tabs.onUpdated.addListener(function(tabid, changeInfo, tab)
{
	if(tabNames[tabid] && tab.title != tabNames[tabid])
	{
		// remember what it would of been called
		tabRestore[tab.id] = tab.title;
		
		// automatically rename it again, should the user wish it
		if(localStorage["auto_rename"])
			chrome.tabs.executeScript(tabid, {code: 'document.title = "'+tabNames[tabid]+'";'}, null);
	}
});

// set option defaults
function onBackgroundLoad()
{
	if(typeof localStorage["auto_rename"] == 'undefined') {
		localStorage["auto_rename"] = 'On';
	}
}

onBackgroundLoad();

</script>

